                  ___________________________________________
                                  C O M S E T
                            Modem / Uart Setup Program
                        Version 12.0..release date 12/20/93
                     from Hank Volpe Copyright 1987 - 1993
                             BBS Phone: 410-256-3631
                           Voice Phone: 410-256-5767
                  ___________________________________________

                                  Introduction

    Comset is a utility that is designed to setup a communications port
    and a AT (Hayes) Compatible smartmodem. Many modems, especially
    internals, do not have a method to reset the modem when it is
    activated, nor does an adequate method exist to setup the serial port
    for use.

    Comset will setup your serial port to any speed from 300 to 115200 bps
    and then check to see if your modem is on-line. If it isn't, Comset
    will perform a hardware reset to "wake" it up. Next a software reset
    is performed by sending the command ATZ. If the reply OK is received,
    you are informed that the modem is fine. If OK is not received, Comset
    will attempt 3 times to reset the modem before informing you of an
    error. If you have an external modem and it is off, Comset will abort
    after setting up the serial port to the desired baud rate.

    What's new in Version 12.0 ?
    ---------------------------
    Version 12 increases the DTE rate to 115,200 bps. The ability
    to toggle a 16550AFN FIFO buffer on or off has been added to the 
    command line. Also, a routine has been added to trap modems that
    send NULLS, which confuses the C language string search routines.
    Finally, the default routines do not use transmitter driven interrupts,
    instead a polled routine is used. Some earlier uarts cannot handle
    transmitter driven routines. The receive routines (of course) are 
    interrupt driven.   

    You can always download the latest version of Comset, plus get user
    support on the Modem Doctor BBS (410-256-3631) 24 hrs a day. All
    users, registered or shareware, are always welcome. Additionally,
    you can find Comset on most national BBS systems.

    Comset attempts to answer your communication utility needs with a 
    product that is more flexible and more powerful than simple 
    Port testers or Port speed adjusting programs. With a top speed of 115.2k,
    redirectable output to a file, and errorcodes returned to batch files.
    Comset 12 also contains a new uart driver that works with all types of
    PC-Compatible uart chips.

             Some of the features of Comset include the following ;
                      Level 1 options...Shareware Version

           ** User Selected baud rates from 300 to 115200 bps.
           ** User Selected Comm port assignments [1 to 4].
           ** User Selected IRQ lines (2-7)
           ** Toggle 16550AFN Buffers ON or OFF
           ** Set 16550AFN trigger levels to 14
           ** Modem Status register testing.
              - Comset tests the registers for DTR/RTS and Carrier Detect
           ** Redirectable output..can be sent to a file for logging.
              or used over any serial link.
           ** RTS/CTS DTR/DSR Handshake testing.
           ** Ability to setup the UART alone for dumb modems or
              other serial devices up to 115.2K baud
           ** "s" switch allows you to swap any comm pointers in memory
           ** "p" switch allows you to see your comm address assignments
           ** Log in of Comm ports 3 & 4 to DOS for use by other programs
              such as high level languages or applications.
           ** Ability to set a uart up and raise control lines without
              the need for an active serial device or modem.

           Registered users have access to this special feature;
           ** Ability to send custom Hayes command strings to the modem
             using a simple ASCII text file

                                I. USING COMSET
                                ----------------
                    The usage syntax for Comset is simple.
                             COMSET [speed] [port] U        or 
                             COMSET [speed] [port]          or
                             COMSET [speed] [port,irq]      or
                             COMSET [speed] [port] ON      or
                             COMSET [speed] [port,irq] ON  or
                             COMSET [speed] [port] U ON    or
                                    COMSET h
                                       or
                                    COMSET i
                                       or
                                    COMSET p
                                       or
                            COMSET s  [port] [port]

                  [speed] and [port] are user options
                  [speed] and [port,irq] are also user options
                   u tells Comset to set the UART only
                  ON tells Comset to activate 16550AFN buffers
                     if using a 16550AFN Uart chip.
                   h invokes runtime help for the user
                   i shows you revision and program information
                   p peeks at your comm port memory address assignments
                   s swaps the memory address assignments between the
                     first port you entered and the second.

    Comset is easy to use. Typing COMSET from the dos prompt will
    automatically attempt to set up serial port Com1 to 2400 bps and
    attempt to wake up its modem. Selecting a different speed involves
    only adding the speed after the word Comset...ie COMSET 1200 sets
    serial port COM1 to 1200 bps instead of the default 2400. Trailing
    zeros are not necessary, so you could also type COMSET 12 to set up
    serial port COM1 to 1200 bps. If you wish to use a different serial
    port, add that after the speed...ie COMSET 24 2 will set serial port
    Com2 to 2400 bps. If you accidentally enter an invalid baud rate, the
    default of 2400 bps will be used. If you accidentally enter an invalid
    range of comm ports, the default of COM1 will be used. Defaults are
    always used if the user does not supply speed and port. Typing  a U
    after any option instructs Comset to setup the  serial port only and
    not to look for a modem.  This is handy for setting up  serial
    printers or other dumb devices to speeds  higher than 9600 baud.
    Mode.com from dos will do the same, but not at 115200 baud, and not
    on all machines!.

    Typing Comset 2400 3,5 will set port 3 using IRQ 5 to 2400 bps. It
    is important to use the comma (,) between the port and the IRQ line.
    Valid IRQ assignments are between 2-7. If you don't include one, Comset
    automatically defaults to PC industry standard selections.

    Typing Comset p will display all of the comm port addresses logged
    into Dos. This can be handy when you are trying to configure a serial
    card for proper addresses.

    Typing Comset s will swap the address assignments in memory of com1
    and com2. If you entered comset s 1 4, then the address assignments
    will be swapped between com1 and com4 instead of com1 and com2. Any
    valid port from 1 to 4 can be used.

    Typing COMSET h will bring up a runtime summary of features and other
    helpful information. Ideally, Comset should be run out of your
    autoexec.bat file when you  first turn on your computer. Internal
    modem users can appreciate the fact that probably 2 or 3 times out of
    a 100 their internal modem does not "wake-up" properly when the
    computer is first turned on, and this can hang-up some communications
    programs. Also, BBS sysops sometimes experience problems with modems
    when stopping the BBS and trying to use the modem to call out.  This
    is why Comset was written!

                         II. SERIAL PORT INFORMATION
                         ---------------------------
    Comset supports all the industry standard Serial Port address
    assignments for modems.  Almost all PC-modems allow you to use COM1-4,
    however only specific software  can use COM3 or COM4 on most machines.
    Comset will not only use COM3 and COM4 itself, but it will log those
    ports into DOS for use by other programs such as high-level languages
    and applications (something that under normal conditions can't be done
    with an IBM-PC or most clones without special software). Using the new
    "s" feature, you can also swap COM3 to COM1's address for those
    programs that cannot access a COM3 or COM4. Using the "p" feature, you
    can find out what serial port assignments your computer is using.

                        III ERROR REPORTING INFORMATION
                        -------------------------------
    Comset checks your serial port in three distinct steps;
    1) Set the Serial Port computer UART to the desired baud rate and
    raise the DTR and RTS lines. If a serial port is not detected, Comset 
    aborts and displays the message that there is no serial port with that 
    COMM designation your system.
    
    2) Check that DSR and CTS are returning from the modem, if not report 
    an error and stop testing.
        
    3 a)If steps 1 & 2 are successful, wake up the modem by sending the 
    command string "ATZ". If OK is received, report all is  Normal and 
    leave the RTS and DTR lines active.
        
      b)If the modem did not wake up, issue a more advanced hardware and
    software command string to reset and wake up the modem. Three attempts 
    are made..if it fails, the RTS and DTR lines are turned off. This 
    could happen
    
    if you tell Comset to test a serial port that does not have a 
    compatible modem attached. In that case, a "failure" of this kind 
    would be "normal" for your system.
            
    You can redirect the output of Comset to a file if you wish to 
    maintain a log of each initialization. To do this, just use the 
    command string;
    
                COMSET [speed] [port] >> comset.log
    
    Speed and port are optional. The >> symbol tells dos to make a file  
    called comset.log and append it each time Comset is run.

                        IV. Support for 16550AFN Uarts
                        ------------------------------
    The new ON feature allows Comset to enable or disable the 16550AFN 
    uart buffers. Some comm programs fail to disable these buffers on
    exit. As a result, DOS or other applications may crash your system
    or refused to use the buffers. The ON switch (as the last thing on
    any command line) enables these buffers and sets the trigger level
    for receive interrupts at 14 characters. OFF (or nothing) disables
    these buffers. When a user enters the ON command, Comset checks to
    see if a 16550AFN is present, and if so, the user is informed that
    this uart has been detected and the buffer trigger level is being set.
    Comset exits with the buffers enabled. Typing OFF or not entering
    the words ON will turn these buffers off.  
    This command can be very powerful for you, because it does test the
    16550AFN's buffers and ability to generate a trigger level interrupt. 
    If you have any doubt about your 16550AFN, Comset can end your worries.
    Registered users, with the custom command files, can interrogate the
    modem over long sequences, verifying the 16550AFN buffers are working
    properly. The :ON command is active in both shareware and registered
    versions.
   
                            V. USING ERRORLEVELS
                            --------------------
     Starting with Version 11, all users of Comset can work with the
    error-code reporting feature. Error code reporting simply stated passes
    "result-codes" from Comset to its calling program. This allows you to write 
    some advanced batch-file procedures or to take specific actions.
    This error-code information can be interpreted by Dos Batch files using 
    the ERRORLEVEL function. Under normal conditions, a result code of 0 is
    returned to the calling program. If something wrong is detected, an 
    error code of 99 is returned to the calling program. A simple use of 
    this can be to start a communications program if the modem is ok, but 
    if not, default to some other action...an example batch-file program 
    looks like this;
         
        echo off
        comset 24 1
         IF ERRORLEVEL 99 goto stop
        echo passed
        goto exit
        :stop
        echo failed!
        :exit
        
    Other uses are left up to your imagination...you could flash up help 
    screens to the user like "HEY DUMMY...TURN ON THE MODEM!!!" or 
    something similar. Combined with redirecting the output to a logging 
    file, you could trace a history of failures or other actions.
    The registered version of Comset has the ability to send custom setup 
    strings to your modem from a simple text file. To use this feature, 
    all you need to do is the following;
    
         1) Make a file with valid AT commands using edlin or any ASCII
             text editor and name the file Comset.cmd
    
          2) Place this file in the same directory that you are running
             comset out of. If you are running Comset from a path, then
             you must have a Comset.cmd file in the directory you are
             currently in for this feature to work. The reason for this
             is  so  that  you  could have multiple  comset.cmd files
             in different directories for different uses.
   
    When  Comset starts,  it will look for Comset.cmd in  the  current 
    default directory,  and if it finds it,  it will send that command 
    string to the modem instead of the ATZ command. An example of such a 
    command set is the following;
    
        From dos, type edlin comset.cmd
        when edlin starts, type I for insert.
        Next, type AT M0 H1 then return
        Next, type control-Z
        Next, type e and the file will save.
    
    The next time you run comset, it will find the file comset.cmd and 
    tell the modem to shut off the speaker and go off-hook.

    Any valid AT command set for your brand of modem can be sent.  The 
    only restriction is that all these commands fit on one line and  the
    first two letters must be AT. 
    
    You  can  also redirect the output of this function to a  file  as 
    explained above. Users of Modems can use this to capture the settings 
    of their modem and save it in text form for future reference.

                              VI. ERROR MESSAGES
    
    THERE IS NO COMx IN YOUR SYSTEM -
          Comset was instructed by the user to test a non-existent comm
          port. This could happen automatically if you don't have a COM1
          in your system. If this is the case, use the line
          COMSET [speed] [port] to select your specific needs.
      
    
    MODEM NOT RESPONDING PROPERLY -
          The modem under test did not set up even after 3 extensive
          hardware and software attempts to do so. Either you have a non-
          compatible or non-intelligent modem, or you are using the wrong
          opening baud rate. Comset's defaults are 2400 bps and COM1. If
          you only  have a 1200 or 300 bps modem, use the line
          COMSET [speed] [port] and use a lower speed. Valid speeds are
          300 bps,  1200 bps , 2400 bps [default], 4800 bps, 9600 bps,
          19200 bps, 38400 bps, 57600 and 115200 bps. Trailing zeros are 
          not necessary..ie 576 is 57600 bps. Any other values default
          automatically to 2400 bps.
   
    MODEM APPEARS TO BE OFF OR DISCONNECTED -
         The hardware handshaking pairs RTS/CTS or DTR/DSR are not 
         communicating properly. This should NEVER happen on internal
         modems unless the CTS signal is not enabled. Internal Modems
         usually keep this signal at a logic 1, so if you see this error,
         check your internal modem for proper strapping of the CTS and DSR
         signals.
        
         If you have an external modem,and the power for the modem is on,
         you will see this error message if you do not have the CTS signal
         at a logic 1 or you have a defective or inadequate Serial Cable.
         Most external modems have Dip-switches on the back for setting
         the CTS signal. Normally the CTS follows the Serial Ports RTS and
         the modem  DSR (sometimes called MR) follows the Serial Ports
         DTR.
        
         In the case of an external modem you will see this error message
         every time the modem has not been turned on. This is telling you
         that your serial port hardware is fine, just that your modem is
         off.

                            VII COMSET PROGRAM HISTORY
                           --------------------------
        Version 1 - Simple Assy program fixed at 300 bps. Two versions
                    COM1 and COM2.

        Version 2 - Baud rate raised to 1200 bps.

        Version 3 - Baud rate raised to 2400 bps.

        Version 4 - COM1 / COM2 support in one program.

        Version 5 - Major rewrite, added interrupt support, hardware
                    and software testing, COM 1-4 support, Multiple
                    baud rate support, error checking and reporting,
                    and support for high speed modems to 19200 bps.

        Version 6 - This version adds the U parameter to allow for testing
                    and setup of dumb modems and other serial devices.
                    The registered version adds the ability to send a
                    custom command string from a file named comset.cmd
                    to the modem in place of the normal ATZ command

        Version 7 - This version adds baud rates to 38.4K,improved Uart
                    communications module.

        Version 8 - This version adds speeds to 56K baud, improved
                    Uart communications module, addition of the
                    comm port swap and comm address features

        Version 9 - Improves speed of routines, adds the ability for
                    uart only setups not to require an active device,
                    changes the top speed description to 57.6k, and
                    adds a test to verify the baud rate register set
                    to the desired baud rate

        Version 10- Suppresses extra line feeds sent by some modems,
                    shortens the sign-on banner, changes timing routines
                    that properly read all data from the modem when running
                    custom commands that take a long time to process..ie
                    a long status report sent at 300 baud could take longer
                    than 15 seconds, now the timer is reset to 0 each time
                    a character is received. Includes the new Uart driver
                    module used in Modem Doctor and Zboot.

        Version 11- Adds IRQ selection to the command line and allows
                    the shareware version to return errorlevel codes

        Version 12- Increases speed to 115,200bps, adds the ability to
                    turn on and off a 16550AFN Uart buffers, fixes a problem 
                    that some modems have in sending NULLS, confusing
                    the C strstr() and strcmp() routines. Also, a reset
                    timer trigger for the registered version was added
                    to properly dump slow buffers and a new Uart module
                    using 16550AFN support was added.

        current released software version is 12.0
